﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace NabNetLib.Clapier
{
    public class LapinManager
    {
        public static Lapin GetLapin(nabnetEntities objectContext, string serialNumber)
        {
            Lapin lapin = null;


            lapin = (from l in objectContext.Lapin where l.serial_number == serialNumber select l).FirstOrDefault();

            
            return lapin;
        }

        public static Lapin RegisterNewLapin(nabnetEntities objectContext, string seriaNumber, string name, string password)
        {
            Lapin lapin = new Lapin()
            {
                serial_number = seriaNumber,
                name = name,
                password = password

            };

            
                objectContext.Lapin.AddObject(lapin);
                objectContext.SaveChanges();
            

            return lapin;
        }

        


    }
}
